/*
ID: majowi1
LANG: JAVA
PROG: friday
*/

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;


final class friday {

	/**
	 * @param args
	 */
	static int[] days = new int[]{0,0,0,0,0,0,0};	
	static int[] months = new int[] {31,28,31,30,31,30,31,31,30,31,30,31};
	static int current_year = 1900;
	static int current_day = 0;
	
public static void main(String[] args)throws IOException {
		
	    BufferedReader f = new BufferedReader(new FileReader("friday.in"));	    
	    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("friday.out")));
	    int years = Integer.parseInt(f.readLine().trim());
		for (int x = 0; x < years ; x++)
			countDays();
		
		System.out.println("" + days[6] + " " + days[1] + " " + days[2] + " " + days[3] + " " + days[4] + " " + days[5] + " " + days[0]);
		
		out.close();                                
	    System.exit(0);
	}
	
	private static void countDays(){
		for (int month : months){
			//is it february, then include isLeapYear
			if ( month == 28){
				for (int x = 1 ; x <= month + isLeapYear(); x++){
					current_day++; 
					if (x == 13)
						days[current_day % 7]++;
				}
			}
			else{
				for (int x = 1 ; x <= month; x++){
					current_day++; 
					if (x == 13)
						days[current_day % 7]++;
				}	
			}
		}
		current_year++;
	}
	
	private static int isLeapYear(){
		//is it a century
		if (current_year % 100 == 0)
			//is the century divisible by 400
			if (current_year % 400 == 0)
				return 1;
			else
				return 0;
		//else is it divisible by 4
		else if (current_year % 4 == 0)
			return 1;
		else
			return 0;
	}
}
